<!--
Date: 2025-08-13
Copyright (c) 2025 Industrial Software Feature Database
-->
<template>
  <div class="busines">
    <MapList v-if="showMapList" @handleEvent="handleEvent" />
    <MapDetail :rowData="rowData" v-if="showMapDetail" @handleEvent="handleEvent" />
    <MapOperate :params="params" :operateType="operateType" :rowData="rowData" v-if="showMapAdd" @handleEvent="handleEvent" />
    <DataInfo v-if="showDataInfo" :modelName="modelName" :versionList="versionList" :sourceId="sourceId" :rowData="rowData" :modelId="modelId" @handleEvent="handleEvent"  />
    <DataList v-if="showSearchRes" :rowData="rowData" type="LinkFromMap" :params="searchParams" @handleEvent="handleEvent" />
    <Result v-if="showResInfo" :rowData="rowData" type="LinkFromMap" :params="searchParams" :dataBaseList="dataBaseList" :tableData="dataList" :modelList="modelList" :sceneList="sceneList" :systemList="systemList" :searchItem="searchItem" :modelId="modelId" @handleEvent="handleEvent" />
  </div>
</template>
<script setup name="BusinessManagement">
import MapList from './component/MapList.vue';
import MapDetail from './component/MapDetail.vue';
import MapOperate from './component/MapOperate.vue';
import DataInfo from './component/DataInfo.vue';
import DataList from '@/views/system/unifiedSearch/pages/DataList.vue';
import Result from '@/views/system/unifiedSearch/pages/SearchRes.vue';
const showSearchRes = ref(false);
const showResInfo = ref(false);
const showDataInfo = ref(false);
const showMapList = ref(true);
const showMapDetail = ref(false);
const showMapAdd = ref(false);
const rowData = ref(null);
const params = ref({});
const searchParams = ref({});
const operateType = ref('');
const modelId = ref('');
const sourceId = ref('');
const versionList = ref([]);
const modelName = ref('');
const handleEvent = (data) => {
  if (data.component === 'List') {
    rowData.value = null;
    showMapDetail.value = false;
    showMapList.value = true;
    showMapAdd.value = false;
    showDataInfo.value = false;
    showSearchRes.value = false;
    showResInfo.value = false;
  }
  if (data.component === 'MapDetail') {
    rowData.value = data.row;
    showMapList.value = false;
    showMapDetail.value = true;
    showMapAdd.value = false;
    showDataInfo.value = false;
    showSearchRes.value = false;
    showResInfo.value = false;
  }
  if (data.component === 'MapOperate') {
    rowData.value = data.row;
    operateType.value = data.type;
    params.value = data.params;
    showMapList.value = false;
    showMapDetail.value = false;
    showMapAdd.value = true;
    showDataInfo.value = false;
    showSearchRes.value = false;
    showResInfo.value = false;
  }
  if (data.component === 'DataInfo') {
    modelId.value = data.modelId;
    rowData.value = data.row;
    sourceId.value = data.sourceId;
    versionList.value = data.versionList;
    modelName.value = data.modelName;
    showMapList.value = false;
    showMapDetail.value = false;
    showMapAdd.value = false;
    showDataInfo.value = true;
    showSearchRes.value = false;
    showResInfo.value = false;
  }
  if (data.component === 'SearchDataList') {
    searchParams.value = data.params;
    rowData.value = data.row;
    showMapList.value = false;
    showMapDetail.value = false;
    showMapAdd.value = false;
    showDataInfo.value = false;
    showSearchRes.value = true;
    showResInfo.value = false;
  }
  if (data.component === 'Result') {
    searchParams.value = data.params;
    rowData.value = data.row;
    modelId.value = data.modelId;
    showMapList.value = false;
    showMapDetail.value = false;
    showMapAdd.value = false;
    showDataInfo.value = false;
    showSearchRes.value = false;
    showResInfo.value = true;
  }
};
</script>
<style lang="scss" scoped>
.busines {
  height: calc(100vh - 84px);
  width: 100%;
}
</style>